package IO流.转换流;

import java.io.*;
//DateOutputDemo
public class DataInputDemo {
    //数据流将“基本数据类型与字符串类型”作为数据源
    public static void main(String[] args) {
     DataInputStream db=null;
        try {
            db=new DataInputStream(new BufferedInputStream(new FileInputStream("E:/dddd.txt")));
           //读取数据，注意：读取的数据 要与写入的数据顺序一致，否则不能正确读取

            System.out.println(db.readInt());

            System.out.println(db.readBoolean());

            System.out.println(db.readChar());
            System.out.println(db.readDouble());
            System.out.println(db.readUTF());



        }catch (Exception e){
            e.printStackTrace();
        }finally {
            try {
                if(db!=null)db.close();

            }catch (Exception e){
                e.printStackTrace();
            }
        }
    }
}



